package Lian02;

import java.util.Arrays;

/**
 * 冒泡排序
 */
public class MaoPaoPaiXu {
    public static void main(String[] args) {
        //外层循环N-1
        //内层循环N-1-i
        int[] arrInt = {20,40,90,10,15,66};
        for (int i = 0; i < arrInt.length-1; i++) {
            for (int j = 0; j <arrInt.length-i-1 ; j++) {
                if (arrInt[j]>arrInt[j+1]){
                    int temp =arrInt[j];
                    arrInt[j] = arrInt[j+1];
                    arrInt[j+1] = temp;
                }
            }
        }
        System.out.println(Arrays.toString(arrInt));
    }
}
